package zw_901_1000.zw_944_删列造序;

class Solution {

    public static void main(String[] args) {
        String[] strs = {"zyx","wvu","tsr"};
        int size = minDeletionSize(strs);
        System.out.println(size);
    }

    public static int minDeletionSize(String[] strs) {
        int row = strs.length;
        int col = strs[0].length();
        int ans = 0;
        for (int j = 0; j < col; ++j) {
            for (int i = 1; i < row; ++i) {
                if (strs[i - 1].charAt(j) > strs[i].charAt(j)) {
                    ans++;
                    break;
                }
            }
        }
        return ans;
    }


//    public static int minDeletionSize(String[] strs) {
//        int n = strs.length, m = strs[0].length(), ans = 0;
//        out:
//        for (int i = 0; i < m; i++) {
//            for (int j = 0, cur = -1; j < n; j++) {
//                int t = (int) strs[j].charAt(i);
//                if (t < cur && ++ans >= 0) continue out;
//                cur = t;
//            }
//        }
//        return ans;
//    }
}
